/*
This file is part of Ext JS 4.2

Copyright (c) 2011-2013 Sencha Inc

Contact:  http://www.sencha.com/contact

GNU General Public License Usage
This file may be used under the terms of the GNU General Public License version 3.0 as
published by the Free Software Foundation and appearing in the file LICENSE included in the
packaging of this file.

Please review the following information to ensure the GNU General Public License version 3.0
requirements will be met: http://www.gnu.org/copyleft/gpl.html.

If you are unsure which license is appropriate for your use, please contact the sales department
at http://www.sencha.com/contact.

Build date: 2013-05-16 14:36:50 (f9be68accb407158ba2b1be2c226a6ce1f649314)
*/
/**
 * Simplified Chinese translation
 * By DavidHu
 * 09 April 2007
 *
 * update by andy_ghg
 * 2009-10-22 15:00:57
 */
Ext.onReady(function() {
    var parseCodes;

    if (Ext.Date) {
        Ext.Date.monthNames = ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"];

        Ext.Date.dayNames = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];

        Ext.Date.formatCodes.a = "(this.getHours() < 12 ? '上午' : '下午')";
        Ext.Date.formatCodes.A = "(this.getHours() < 12 ? '上午' : '下午')";

        parseCodes = {
            g: 1,
            c: "if (/(上午)/i.test(results[{0}])) {\n"
                + "if (!h || h == 12) { h = 0; }\n"
                + "} else { if (!h || h < 12) { h = (h || 0) + 12; }}",
            s: "(上午|下午)",
            calcAtEnd: true
        };

        Ext.Date.parseCodes.a = Ext.Date.parseCodes.A = parseCodes;
    }

    if (Ext.util && Ext.util.Format) {
        Ext.apply(Ext.util.Format, {
            thousandSeparator: ',',
            decimalSeparator: '.',
            currencySign: '\u00a5',
            // Chinese Yuan
            dateFormat: 'y年m月d日'
        });
    }
});

Ext.define("Ext.locale.zh_CN.view.View", {
    override: "Ext.view.View",
    emptyText: ""
});

Ext.define("Ext.locale.zh_CN.grid.plugin.DragDrop", {
    override: "Ext.grid.plugin.DragDrop",
    dragText: "选择了 {0} 行"
});

Ext.define("Ext.locale.zh_CN.tab.Tab", {
    override: "Ext.tab.Tab",
    closeText: "关闭此标签"
});

Ext.define("Ext.locale.zh_CN.form.field.Base", {
    override: "Ext.form.field.Base",
    invalidText: "输入值非法"
});

// changing the msg text below will affect the LoadMask 
Ext.define("Ext.locale.zh_CN.view.AbstractView", {
    override: "Ext.view.AbstractView",
    loadingText: "读取中..."
});

Ext.define("Ext.locale.zh_CN.picker.Date", {
    override: "Ext.picker.Date",
    todayText: "今天",
    minText: "日期必须大于最小允许日期",
    //update
    maxText: "日期必须小于最大允许日期",
    //update
    disabledDaysText: "",
    disabledDatesText: "",
    nextText: '下个月 (Ctrl+Right)',
    prevText: '上个月 (Ctrl+Left)',
    monthYearText: '选择一个月 (Control+Up/Down 来改变年份)',
    //update
    todayTip: "{0} (空格键选择)",
    format: "y年m月d日",
    ariaTitle: '{0}',
    ariaTitleDateFormat: 'Y\u5e74m\u6708d\u65e5',
    longDayFormat: 'Y\u5e74m\u6708d\u65e5',
    monthYearFormat: 'Y\u5e74m\u6708',
    getDayInitial: function (value) {
        // Grab the last character
        return value.substr(value.length - 1);
    }
});

Ext.define("Ext.locale.zh_CN.picker.Month", {
    override: "Ext.picker.Month",
    okText: "确定",
    cancelText: "取消"
});

Ext.define("Ext.locale.zh_CN.toolbar.Paging", {
    override: "Ext.PagingToolbar",
    beforePageText: "第",
    //update
    afterPageText: "页,共 {0} 页",
    //update
    firstText: "第一页",
    prevText: "上一页",
    //update
    nextText: "下一页",
    lastText: "最后页",
    refreshText: "刷新",
    displayMsg: "显示 {0} - {1}条，共 {2} 条",
    //update
    emptyMsg: '没有数据'
});

Ext.define("Ext.locale.zh_CN.form.field.Text", {
    override: "Ext.form.field.Text",
    minLengthText: "此值最小长度是 {0} &nbsp;",
    maxLengthText: "此值最大长度是 {0} &nbsp;",
    blankText: "此项是必填项",
    regexText: "",
    emptyText: null
});

Ext.define("Ext.locale.zh_CN.form.field.Number", {
    override: "Ext.form.field.Number",
    minText: "该输入项的最小值是 {0}",
    maxText: "该输入项的最大值是 {0}",
    nanText: "{0} 不是有效数值",
    negativeText : '该输入项不能为负数'
});

Ext.define("Ext.locale.zh_CN.form.field.Date", {
    override: "Ext.form.field.Date",
    disabledDaysText: "禁用",
    disabledDatesText: "禁用",
    minText: "该输入项的日期必须在 {0} 之后",
    maxText: "该输入项的日期必须在 {0} 之前",
    invalidText: "{0} 是无效的日期 - 必须符合格式： {1}",
    format: "y年m月d日"
});

Ext.define("Ext.locale.zh_CN.form.field.ComboBox", {
    override: "Ext.form.field.ComboBox",
    valueNotFoundText: undefined
}, function() {
    Ext.apply(Ext.form.field.ComboBox.prototype.defaultListConfig, {
        loadingText: "加载中..."
    });
});

Ext.define("Ext.locale.zh_CN.form.field.VTypes", {
    override: "Ext.form.field.VTypes",
    emailText: '该输入项必须是电子邮件地址，格式如： "user@example.com"',
    urlText: '该输入项必须是URL地址，格式如： "http:/' + '/www.example.com"',
    alphaText: '该输入项只能包含半角字母和_',
    alphanumText: '该输入项只能包含半角字母,数字和_'
});

//add HTMLEditor's tips by andy_ghg
Ext.define("Ext.locale.zh_CN.form.field.HtmlEditor", {
    override: "Ext.form.field.HtmlEditor",
    createLinkText: '添加超级链接:'
}, function() {
    Ext.apply(Ext.form.field.HtmlEditor.prototype, {
        buttonTips: {
            bold: {
                title: '粗体 (Ctrl+B)',
                text: '将选中的文字设置为粗体',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            italic: {
                title: '斜体 (Ctrl+I)',
                text: '将选中的文字设置为斜体',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            underline: {
                title: '下划线 (Ctrl+U)',
                text: '给所选文字加下划线',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            increasefontsize: {
                title: '增大字体',
                text: '增大字号',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            decreasefontsize: {
                title: '缩小字体',
                text: '减小字号',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            backcolor: {
                title: '以不同颜色突出显示文本',
                text: '使文字看上去像是用荧光笔做了标记一样',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            forecolor: {
                title: '字体颜色',
                text: '更改字体颜色',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            justifyleft: {
                title: '左对齐',
                text: '将文字左对齐',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            justifycenter: {
                title: '居中',
                text: '将文字居中对齐',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            justifyright: {
                title: '右对齐',
                text: '将文字右对齐',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            insertunorderedlist: {
                title: '项目符号',
                text: '开始创建项目符号列表',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            insertorderedlist: {
                title: '编号',
                text: '开始创建编号列表',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            createlink: {
                title: '转成超级链接',
                text: '将所选文本转换成超级链接',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            sourceedit: {
                title: '代码视图',
                text: '以代码的形式展现文本',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            }
        }
    });
});

Ext.define("Ext.locale.zh_CN.grid.header.Container", {
    override: "Ext.grid.header.Container",
    sortAscText: "正序",
    //update
    sortDescText: "倒序",
    //update
    lockText: "锁定列",
    //update
    unlockText: "解除锁定",
    //update
    columnsText: "列"
});

Ext.define("Ext.locale.zh_CN.grid.PropertyColumnModel", {
    override: "Ext.grid.PropertyColumnModel",
    nameText: "名称",
    valueText: "值",
    dateFormat: "y年m月d日"
});

Ext.define("Ext.locale.zh_CN.window.MessageBox", {
    override: "Ext.window.MessageBox",
    buttonText: {
        ok: "确定",
        cancel: "取消",
        yes: "是",
        no: "否"
    }    
});

Ext.define("Ext.locale.zh_CN.hscore.widgets.form.field.DateTimePicker", {
    override: "hscore.widgets.form.field.DateTimePicker",
    okText:'确定',
    okTip:'确定',
    todayText : '现在',
    todayTip : '现在'
});

// This is needed until we can refactor all of the locales into individual files
Ext.define("Ext.locale.zh_CN.Component", {	
    override: "Ext.Component"
});

Ext.define("Ext.locale.zh_CN.form.Field", {	
    override: "Ext.form.Field",
	labelSeparator : '：'
});

Ext.define("Ext.locale.zh_CN.form.FieldContainer", {	
    override: "Ext.form.FieldContainer",
	labelSeparator : '：'
});


Ext.define('Ext.locale.zh_CN.validation.HSVTypes', {
	override : 'Ext.form.VTypes',
	requires: ['hscore.overrides.validation.HSValidations', 'hscore.utils.Utils'],
	//wildemail
	'wildemail' :  function (v) {
		return Ext.data.validations.isWildMail(v);
	},
	'wildemailText' : '此配置项应该是电子邮件地址格式，例如："user@example.com"或者"*@example.com"',
	
	//email
	'email' : function(v){
		return Ext.data.validations.isEmail(v);
	},
	'emailText': '此配置项应该是电子邮件地址格式，例如："user@example.com"',
	
	//alpha
	'alpha': function(v, field) {
		return Ext.data.validations.isAlpha(v);
	},
	'alphaText': '只能输入字母或下划线',
	
	//字母、数字或下划线
	'alphanum': function(v, field) {
		return Ext.data.validations.isAlphaNum(v);
	},
	'alphanumText': '只能输入字母、数字或下划线',
	
	//字母或数字
	'alphanumx1': function(v, field) {
		return Ext.data.validations.isAlphaNumX1(v)
	},
	'alphanumx1Text': '只能输入字母或数字',
	
	//IsNum
	'num': function(v, field) {
		return Ext.data.validations.isNum(v);
	},
	'numText': '只能输入数字',
	
	//此配置项只能包含英文字母、数字、空格、"."、"-"、"_"和"@"
	'bannerstr' : function (v, field) {
		var tmpTips = '';

		var allowBlank = field.allowBlank;
		if (!allowBlank && Ext.data.validations.isEmptyString(v) == true) {
			return false;
		}
		if(field.maxLength) {
			var maxLength = parseInt(field.maxLength, 10);
			if (Ext.data.validations.getStringByteLength(v) > maxLength) {
				tmpTips += '不能超过'+ maxLength+'个英文字符或'+parseInt(maxLength/3)+'个汉字';
				Ext.form.VTypes['bannerstrText'] = tmpTips;
				return false;
			}
		}
		return Ext.data.validations.isNotContainBannerStr.test(v);
	},
	'bannerstrText' : '此配置项只能包含英文字母、数字、空格、"."、"-"、"_"和"@"',
	
	//邮政编码
	'post': function (v, field) {
		return Ext.data.validations.isPost(v);
	},
	'postText': '不是正确的邮政编码格式',
	
	//isp名称
	'ispNameStr': function (v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && Ext.data.validations.isEmptyString(v) == true) {
			tmpTips += '不能为空' ;
			return false;
		}
		if(field.maxLength) {
			var maxLength = parseInt(field.maxLength, 10);
			if (Ext.data.validations.getStringByteLength(v) > maxLength) {
				tmpTips += '不能超过'+ maxLength+'个英文字符或'+parseInt(maxLength/3)+'个汉字';
				Ext.form.VTypes['ispNameStrText'] = tmpTips;
				return false;
			}
		}
		if(field.minLength) {
			var minLength = parseInt(field.minLength, 10);
			if (Ext.data.validations.getStringByteLength(v) < minLength) {
				tmpTips += '不能少于'+minLength+'个英文字符或'+parseInt(minLength)+'个汉字';
				Ext.form.VTypes['ispNameStrText'] = tmpTips;
				return false;
			}
		}
		return Ext.data.validations.isIspNameStr(v);
		
	},
	'ispNameStrText': '此项只能包含中英文字符、数字、"*"、"-"和"&"<br/>如: abc*12',
	
	//不能包含中文的字符串
	'strnozh': function(v,field) {
		var tmpTips = '';

		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['strnozhText'] = tmpTips;
			return false;
		}
		
		if (Ext.data.validations.isEmptyString(v) == true) {
			return false;
		}
		if (Ext.data.validations.checkStrExCludeChinese(v) == false) {
			return false;
		}
		if (Ext.data.validations.strCommon(v) == false) {
			return false;
		}
		return true;
	},
	'strnozhText' : '此配置项不能包含中文字符和双引号<br/>例如：testStr_1',
	
	//不能包含双引号的字符串
	'string' : function (v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && Ext.data.validations.isEmptyString(v) == true) {
			tmpTips += '不能为空' ;
			return false;
		}
		if(field.maxLength) {
			var maxLength = parseInt(field.maxLength, 10);
			if (Ext.data.validations.getStringByteLength(v) > maxLength) {
				tmpTips += '不能超过' 
							+ maxLength 
							+ '个英文字符或' 
							+ parseInt(maxLength/3) 
							+ '个汉字';
				Ext.form.VTypes['stringText'] = tmpTips;
				return false;
			}else{
				Ext.form.VTypes['stringText'] = '此配置项只能包含中文、英文、数字、空格、特殊字符( " 除外)<br/>eg: abc_12';
			}
		}
		if(field.minLength) {
			var minLength = parseInt(field.minLength, 10);
			if (Ext.data.validations.getStringByteLength(v) < minLength) {
				tmpTips += '不能少于'
							+ minLength +'个英文字符或'
							+ parseInt(minLength/3) + '个汉字';
				Ext.form.VTypes['stringText'] = tmpTips;
				return false;
			}else{
				Ext.form.VTypes['stringText'] = '此配置项只能包含中文、英文、数字、空格、特殊字符( " 除外)<br/>eg: abc_12';
			}
		}
		return Ext.data.validations.strCommon(v);
	},
	'stringText' : '此配置项只能包含中文、英文、数字、空格、特殊字符( " 除外)<br/>eg: abc_12',
	
	//ipv6
	'ipv6': function(v, field){
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['ipText'] = tmpTips;
			return false;
		}
		return Ext.data.validations.isIpv6(v);
	},
	'ipv6Text': '不是有效的IPV6格式',
	
	//ipv4g
	'ipv4g':  function(v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['ipText'] = tmpTips;
			return false;
		}
		return Ext.data.validations.isIpv4G(v);
	},
	'ipv4gText': '请输入合法的IP地址!<br/>格式如：127.0.0.1 不可输入组播地址（224.0.0.0~239.255.255.255）',
	
	//ipv4
	'ipv4':  function(v, field) {
		var tmpTips = '';

		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['ipText'] = tmpTips;
			return false;
		}
		return Ext.data.validations.isIpv4(v);
	},
	'ipv4Text': '不是正确的IPv4地址',
	
	//ip
	'ip': function (v, field) {
		var tmpTips = '';
		var isIPV4 = false;
		var isIPV6 = false;
		var ipv4_255 = false;
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['ipText'] = tmpTips;
			return false;
		}
		isIPV4 = Ext.data.validations.isIpv4(v);
		ipv4_255 = Ext.data.validations.isIpv4(v, 2);
		isIPV6 = Ext.data.validations.isIpv6(v);
		if (isIPV4 || ipv4_255 || isIPV6) {
			return true;
		}
		return false;
	},
	'ipText' : '请输入合法的IP地址 &nbsp;',
	
	//ip0,不能输入IP地址:0.0.0.0
	'ipo' : function (v, field) {
		var tmpTips = '';
		var isIPV4 = false;
		var isIPV6 = false;
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['ipoText'] = tmpTips;
			return false;
		}
		if (v == '0.0.0.0') {
			tmpTips += '不能为&nbsp0.0.0.0!';
			Ext.form.VTypes['ipoText'] = tmpTips;
			return false;
		}
		isIPV4 = Ext.data.validations.isIpv4(v);
		isIPV6 = Ext.data.validations.isIpv6(v);
		if (isIPV4 || isIPV6) {
			return true;
		}
		Ext.form.VTypes['ipoText'] = '不是正确的IP地址格式';
		return false;
	},
	'ipoText' : '不是正确的IP地址格式',
	
	//ip地址，不能为127.0.0.1
	'haip' : function (v, field) {
		var tmpTips = '';
		var isIPV4 = false;
		var isIPV6 = false;
		var fieldLabel = field.fieldLabel;
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['ipText'] = tmpTips;
			return false;
		}
		isIPV4 = Ext.data.validations.isIpv4(v);
		isIPV6 = Ext.data.validations.isIpv6(v);
		if (!Ext.data.validations.isIpv4(v, 1)) {
			return false;
		}
		if (v == '127.0.0.1') {
			return false;
		}
		var maskField = field.haip.maskField;
		
		if (isIPV4 || isIPV6) {
			return true;
		}
		return false;
	},
	'haipText' : '不是正确的IP地址格式',
	
	//ipx0
	'ipx0' : function (v, field) {
		var tmpTips = '';
		var isIPV4 = false;
		var isIPV6 = false;
			
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['ipx0Text'] = tmpTips;
			return false;
		}
		isIPV4 = Ext.data.validations.isIpv4(v, 1);
		isIPV6 = Ext.data.validations.isIpv6(v);
		if (isIPV4 || isIPV6) {
			return true;
		}
		return false;
	},
	'ipx0Text' : '不是正确的IP地址格式',
	
	//ipx1
	'ipx1' : function (v, field) {
		var tmpTips = '';
		var isIPV4 = false;
		var isIPV6 = false;
	
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['ipx1Text'] = tmpTips;
			return false;
		}
		isIPV4 = Ext.data.validations.isIpv4(v, 1);
		isIPV6 = Ext.data.validations.isIpv6(v);
		if (isIPV4 || isIPV6) {
			return true;
		}
		return false;
	},
	'ipx1Text' : '请输入合法的网关',
	
	//ipx2
	'ipx2' : function (v, field) {
		var tmpTips = '';
		var isIPV4 = false;

		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['ipx2Text'] = tmpTips;
			return false;
		}
		isIPV4 = Ext.data.validations.isIpv4(v, 2);
		
		if (isIPV4) {			
			return true;
		}
		return false;
	},
	'ipx2Text' : '不是正确的IP地址格式',
	
	//Mac地址
	'mac': function (v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['macText'] = tmpTips;
			return false;
		}
		if (Ext.data.validations.isMac(v) == false) {
			return false;
		}
		if (Ext.data.validations.isBroadcastMac(v) == true) {
			tmpTips += '这是个广播MAC';
			return false;
		}
		return true;
	},
	'macText': '不是正确的Mac地址格式',
	
	//host id
	'hostid': function (v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['hostidText'] = tmpTips;
			return false;
		}
		if (field.hostid) {
			var maxLength = parseInt(field.hostid.maxLength, 10);
			if (v.length != 0) {
				if (v.length != maxLength) {
					return false;
				}
			}
		}
		return true;
	},
	'hostidText': '请输入合法的Host ID',
	
	//dotmask
	'dotmask': function (v, field) {
		if (v.length != 0) {
			if (Ext.data.validations.isDottedNetmaskV4(v) == false) {
				return false;
			}
		}
		return true;
	},
	'dotmaskText': '不是正确的点分十进制子网掩码',
	
	//dotmaskx1
	'dotmaskx1': function (v, field) {		
		if (v.length != 0) {
			if (v == "0.0.0.0") {
				return true;
			}
			if (Ext.data.validations.isDottedNetmaskV4(v) == false) {
				return false;
			}v		}
		return true;
	},
	'dotmaskx1Text': '不是正确的点分十进制子网掩码',
	
	//nummask
	'nummask': function (v, field) {
		var tmpTips = '';
		var fieldLabel = field.fieldLabel;
		
		var maxLength = field.maxLength;
		if (v.length > maxLength) {
			return false;
		}
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['nummaskText'] = tmpTips;
			return false;
		}
		if (v.length != 0) {
			if (Ext.data.validations.isNumNetmask(v, 'ipv4') == false) {
				if (field.nummask) {
					var forIPV4 = Ext.getCmp(field.nummask.targetId).getValue();
					if(forIPV4 != "0.0.0.0"){
						return false;
					}
				}
			}
		}
		return true;
	},
	'nummaskText': '请输入合法的掩码值! 如:24',
	
	//netmask
	'netmask': function (v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['netmaskText'] = tmpTips;
			return false;
		}
		if (v.length != 0) {
			if (!(Ext.data.validations.isNumNetmask(v, 'ipv4') || Ext.data.validations.isDottedNetmaskV4(v))) {
				return false;
			}
		}
		return true;
	},
	'netmaskText': '不是正确的IPv4或掩码格式',
	
	//netmask1,增加对0的验证,0返回false
	'netmask1': function (v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['netmask1Text'] = tmpTips;
			return false;
		}
		if(parseInt(v,10) == 0){
			return false;
		}
		if (v.length != 0) {
			if (!(Ext.data.validations.isNumNetmask(v, 'ipv4') || Ext.data.validations.isDottedNetmaskV4(v))) {
				return false;
			}
		}
		return true;
	},
	'netmask1Text': '不是正确的IPv4或掩码格式',
	
	//netmask2,增加对0-14的验证,0-14返回false
	'netmask2': function (v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['netmask2Text'] = tmpTips;
			return false;
		}
		if(parseInt(v,10) == 0){
			return false;
		}
		if (v.length != 0) {
			if (!(Ext.data.validations.isNumNetmask(v, 'ipv4') || Ext.data.validations.isDottedNetmaskV4(v))) {
				tmpTips = '不是正确的IPv4或掩码格式';
				Ext.form.VTypes['netmask2Text'] = tmpTips;
				return false;
			}
			if(Ext.data.validations.isNumNetmask(v, 'ipv4')){
				var num = parseInt(v, 10);
				if(num >=1 && num <= 14){
					tmpTips = '掩码长度应该大于14';
					Ext.form.VTypes['netmask2Text'] = tmpTips;
					return false;
				}
			}
			else if(Ext.data.validations.isDottedNetmaskV4(v)){
				var num = hscore.utils.Utils.ipToMaskInt(v);
				if(num >=1 && num <= 14){
					tmpTips = '掩码长度应该大于14';
					Ext.form.VTypes['netmask2Text'] = tmpTips;
					return false;
				}
			}
		}
		return true;
	},
	'netmask2Text': '不是正确的IPv4或掩码格式',
	
    //submask
    'submask': function (v, field) {
        var tmpTips = '';
        
        var allowBlank = field.allowBlank;
        if (!allowBlank && v.length == 0) {
            tmpTips += '不能为空';
            Ext.form.VTypes['netmaskTextx1'] = tmpTips;
            return false;
        }
        if (v.length != 0) {
            if (v == "0.0.0.0" || v == "0") {
                return true;
            }
            if (!(Ext.data.validations.isNumNetmask(v, 'ipv4') || Ext.data.validations.isDottedNetmaskV4(v))) {
                return false;
            }
        }
        return true;
    },
    'submaskText': '请输入合法的子网掩码地址 &nbsp;',
    
	//netmaskx1
	'netmaskx1': function (v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['netmaskTextx1'] = tmpTips;
			return false;
		}
		if (v.length != 0) {
			if (v == "0.0.0.0" || v == "0") {
				return true;
			}
			if (!(Ext.data.validations.isNumNetmask(v, 'ipv4') || Ext.data.validations.isDottedNetmaskV4(v))) {
				return false;
			}
		}
		return true;
	},
	'netmaskx1Text': '请输入合法的子网掩码! 如:255.255.255.0 或者24',
	
	//wildmask
	'wildmask': function (v, field) {
		var tmpTips = '';
	
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['wildmaskText'] = tmpTips;
			return false;
		}

		if (v.length != 0) {
			if (Ext.data.validations.isNumNetmask(v, 'ipv4') == true) {
				return true;
			}
			if (Ext.data.validations.isWildNetmaskV4(v) == true) {
				return true;
			}
			return false;
		}
		return true;
	},
	'wildmaskText': '请输入合法的子网掩码! 如:255.255.255.0 或者24',
	
	//wildmaskx1
	'wildmaskx1': function (v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['wildmaskText'] = tmpTips;
			return false;
		}

		if (v.length != 0) {
			if (Ext.data.validations.isNumNetmask(v, 'ipv4') == true) {
				return false;
			}
			if (Ext.data.validations.isWildNetmaskV4(v) == true) {
				return true;
			}
			return false;
		}
		return true;
	},
	'wildmaskx1Text': '请输入合法的子网掩码! 如:255.255.255.0 或者24',
	
	//Wlan wep key 
	'weppwd' :  function (v,field) {
		if(v.length !=5 && v.length !=13) {
			if (!Ext.data.validations.isHex(v)) {
				return false;
			} else {
				if (v.length !=10 && v.length !=26) {
					return false;
				}else {
					return true;
				}
			}
		}else {
			return true;
		}
	},
	'weppwdText' : 'WEP密码必须符合下列条件之一<br />-5位或13位的字符串<br />-10位或26位的十六进制字符串(0~9)和(A~F)',
	
	//Wlan PSK key
	'wpapwd' :  function (v,field) {
		if(v.length <8 || v.length >63) {
			if (!Ext.data.validations.isHex(v)) {
				return false;
			} else {
				if (v.length !=64) {
					return false;
				}else {
					return true;
				}
			}
		}else {
			return true;
		}
	},
	'wpapwdText' : 'WPA密码必须符合下列条件之一<br />-8~63位的字符串<br />-64位的十六进制字符串(0~9)和(A~F)',
	
	//domain_url
	'domain_url': function (v, field) {
        var tmpTips = '';
        var allowBlank = field.allowBlank;
        if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
            Ext.form.VTypes['domainText'] = tmpTips;
            return false;
        }
        if (v.length != 0) {
            if (Ext.data.validations.isDomainForURL(v)) {
                return true;
            } else {
                return false;
            }
        }
        return true;
    },
    'domain_urlText': '请输入合法的域名或IP地址!<br/>格式如：abc.com或127.0.0.1',
	
	//domain_url_with_wildchar
	'domain_url_with_wildchar': function (v, field) {
        var tmpTips = '';
       
        var allowBlank = field.allowBlank;
        if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
            Ext.form.VTypes['domainText'] = tmpTips;
            return false;
        }
        if (v.length != 0) {
            if (Ext.data.validations.isDomainWithWildcharForURL(v)) {
                return true;
            } else {
                return false;
            }
        }
        return true;
    },
    'domain_url_with_wildcharText': '请输入合法的域名或IP地址(可以带有通配符*号)!<br/>格式如：*.abc.com或127.0.0.*',
	
	//domain
	'domain': function (v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['domainText'] = tmpTips;
			return false;
		}
		if (v.length != 0) {
			if (Ext.data.validations.isDomain(v)) {
				return true;
			} else {
				return false;
			}
		}
		return true;
	},
	'domainText': '请输入合法的域名或IP地址!<br/>格式如：abc.com或127.0.0.1',
	
	//domainorip
	'domainorip' :  function (v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['domainText'] = tmpTips;
			return false;
		}
		if (v.length != 0) {
			if (Ext.data.validations.isDomain(v) 
				|| Ext.data.validations.isIpv4(v) 
				|| Ext.data.validations.isIpv6(v)) {
				return true;
			} else {
				return false;
			}
		}
		return true;
	},
	'domainoripText': '请输入合法的域名或IP地址!<br/>格式如：abc.com或127.0.0.1',
	
	//pwd
	'pwd': function (v, field) {
		var tmpTips = '';
		if (field.pwd) {
			var minLen = field.pwd.minLength;
			var maxLen = field.pwd.maxLength;
			if (minLen && minLen > v.length) {
				tmpTips += '密码长度应该大于等于' + minLen;
				tmpTips += '个字符';
				Ext.form.VTypes['pwdText'] = tmpTips;
				return false;
			}
			if (maxLen && maxLen < v.length) {
				tmpTips += '密码长度应该小于等于' + maxLen;
				tmpTips += '个字符';
				Ext.form.VTypes['pwdText'] = tmpTips;
				return false;
			}
		}
		if (Ext.data.validations.checkStrExCludeChinese(v) == false) {
			tmpTips += '密码不能含有中文字符';
			Ext.form.VTypes['pwdText'] = tmpTips;
			return false;
		}
		return true;
	},
	'pwdText': '输入密码长度不匹配',
	
	//confirm
	'confirm': function (v, field) {
		var tmpTips = '';
		if (field.confirm) {
			var targetObj = Ext.getCmp(field.confirm.targetId);
			var psw = targetObj.getValue();
			if (psw.length != 0 && v != psw) {
				return false;
			}
			if (psw.length == 0 && v.length != 0) {
			tmpTips = '密码为空不需要输入确认密码';
				Ext.form.VTypes['confirmText'] = tmpTips;
				return false;
			}
		}
		return true;
	},
	'confirmText': '与输入密码不匹配',
	
	//compare
	'compare': function (v, field) {
		var tmpTips = '';
		var targetObj = Ext.getCmp(field.compare.targetId);
		var targetFieldLabel = field.compare.targetFieldLabel;
		var targetObjVal = targetObj.getValue();
		var selfVal;
		var targetVal;
		var dtype = field.compare.dtype;
		var min = field.compare.min;
		var minVal;
		var max = field.compare.max;
		var maxVal;
		var fieldLabel = field.fieldLabel;
		var operator = field.compare.operator;
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['compareText'] = tmpTips;
			return false;
		}
		
		if(field.compare) {
			if (dtype == 'int') {
				if(!Ext.data.validations.isInt(v)) {
					tmpTips += '必须是整数!';
					Ext.form.VTypes['compareText'] = tmpTips;
					return false;
				}
				selfVal = parseInt(v, 10);
				/* if (!Ext.data.validations.isInt(targetObjVal)) {
					return true;
				} */
				if(Ext.data.validations.isInt(targetObjVal)){
					targetVal = parseInt(targetObjVal, 10);
					targetValue = parseInt(targetVal/10)+1;
				}
				minVal = parseInt(min, 10);
				maxVal = parseInt(max, 10);
			} else if (dtype == 'hex') {
				if(!Ext.data.validations.isHex(v)){
					tmpTips += '必须是十六进制数!';
					Ext.form.VTypes['compareText'] = tmpTips;
					return false;
				}
				selfVal = parseInt(v, 16);
				if (!Ext.data.validations.isHex(targetObjVal)) {
					return false;
				}
				targetVal = parseInt(targetObjVal, 16);
				minVal = parseInt(min, 16);
				maxVal = parseInt(max, 16);
			} else if (dtype == 'ip') {
				if(Ext.data.validations.isIpv4(v) == false) {
					tmpTips = '请输入合法的IP地址';
					Ext.form.VTypes['compareText'] = tmpTips;
					return false;
				}
				selfVal = Ext.data.validations.str2IP(v);
				if(Ext.data.validations.isIpv4(targetObjVal) == false) {
					return false;
				}
				targetVal = Ext.data.validations.str2IP(targetObjVal);
				if (min) {
					minVal = Ext.data.validations.str2IP(min);
				}
				if (max) {
					maxVal = Ext.data.validations.str2IP(max);
				}
			} else if (dtype == 'ipx1') {
				if(Ext.data.validations.isIpv4(v, 1) == false) {
					tmpTips = '请输入合法的IP地址';
					Ext.form.VTypes['compareText'] = tmpTips;
					return false;
				}
				selfVal = Ext.data.validations.str2IP(v);
				if(Ext.data.validations.isIpv4(targetObjVal, 1) == false) {
					return false;
				}
				targetVal = Ext.data.validations.str2IP(targetObjVal);
				if (min) {
					minVal = Ext.data.validations.str2IP(min);
				}
				if (max) {
					maxVal = Ext.data.validations.str2IP(max);
				}
			} else if (dtype == 'ipo') {
				if(Ext.data.validations.isIpv4(v, 1) == false) {
					tmpTips = '请输入合法的IP地址';
					Ext.form.VTypes['compareText'] = tmpTips;
					return false;
				}
				if(v == '0.0.0.0') {
					tmpTips = '不能为 0.0.0.0!';
					Ext.form.VTypes['compareText'] = tmpTips;
					return false;
				}
				selfVal = Ext.data.validations.str2IP(v);
				if(Ext.data.validations.isIpv4(targetObjVal, 1) == false) {
					return false;
				}
				targetVal = Ext.data.validations.str2IP(targetObjVal);
				if (min) {
					minVal = Ext.data.validations.str2IP(min);
				}
				if (max) {
					maxVal = Ext.data.validations.str2IP(max);
				}
			}else if (dtype == 'ipx2') {
				if(Ext.data.validations.isIpv4(v, 2) == false) {
					tmpTips = '请输入合法的IP地址';
					Ext.form.VTypes['compareText'] = tmpTips;
					return false;
				}
				selfVal = Ext.data.validations.str2IP(v);
				if(Ext.data.validations.isIpv4(targetObjVal, 2) == false) {
					return false;
				}
				targetVal = Ext.data.validations.str2IP(targetObjVal);
				if (min) {
					var minTips;
					if (typeof min == 'function') {
						minVal = Ext.data.validations.str2IP(min());
						minTips = min();
					} else {
						minVal = Ext.data.validations.str2IP(min);
						minTips = min;
					}
				}
				if (max) {
					var maxTips;
					if (typeof max == 'function') {
						maxVal = Ext.data.validations.str2IP(max());
						maxTips = max();
					} else {
						maxVal = Ext.data.validations.str2IP(max);
						maxTips = max;
					}
				}
			} else if (dtype == 'time') {				
				targetVal = Ext.data.validations.timeStr2Int(targetObjVal);
				selfVal = Ext.data.validations.timeStr2Int(v);				
			} else if (dtype == 'week') {
				selfVal = field.value;
				targetVal = parseInt(targetObjVal, 10);
			}
			
			if ((selfVal < minVal || selfVal > maxVal) && (minVal||minVal == 0) && (maxVal||maxVal == 0)) {
				if(dtype !='ipx2'){
					var minTips = minVal;
					var maxTips = maxVal;
				}
				tmpTips = '输入数据越界!<br/>数据范围:' + minTips + '~' + maxTips;
				Ext.form.VTypes['compareText'] = tmpTips;
				return false;
			}
			if (operator == '>' && selfVal <= targetVal) {
				tmpTips += '应该大于' + (targetFieldLabel ? targetFieldLabel : targetObjVal);
				Ext.form.VTypes['compareText'] = tmpTips;
				return false;
			} else if (operator == '<' && selfVal >= targetVal) {
				tmpTips += '应该小于' + (targetFieldLabel ? targetFieldLabel : targetObjVal);
				Ext.form.VTypes['compareText'] = tmpTips;
				return false;
			} else if (operator == '>=' && selfVal < targetVal) {
				tmpTips += '应该大于或等于' + (targetFieldLabel ? targetFieldLabel : targetObjVal);
				Ext.form.VTypes['compareText'] = tmpTips;
				return false;
			} else if (operator == '<=' && selfVal > targetVal) {
				tmpTips += '应该小于或等于' + (targetFieldLabel ? targetFieldLabel : targetObjVal);
				Ext.form.VTypes['compareText'] = tmpTips;
				return false;
			} else if (operator == '' && selfVal < targetValue) {
				tmpTips += '应该大于或等于' + (targetFieldLabel ? targetFieldLabel : targetValue);
				Ext.form.VTypes['compareText'] = tmpTips;
				return false;
			} else if (operator == '' && selfVal > targetVal) {
				tmpTips += '应该小于或等于' + (targetFieldLabel ? targetFieldLabel : targetObjVal);
				Ext.form.VTypes['compareText'] = tmpTips;
				return false;
			} 
		}
		return true;
	},
	'compareText': '请输入合法值!',
	
	//multitimecomp
	'multitimecomp' : function (v, field) {
		var tmpTips = '';
		var startTargetObj = Ext.getCmp(field.compare.startTargetId);
		var endTargetObj = Ext.getCmp(field.compare.endTargetId);
		var startTimeObj = Ext.getCmp(field.compare.startTimeId);		
		var startTargetVal = startTargetObj.getValue();
		var endTargetVal = endTargetObj.getValue();
		var startTimeVal = startTimeObj.getValue();
		var selfVal;
		//var targetVal;
		var dtype = field.compare.dtype;
		var startFieldLabel = startTargetObj.fieldLabel;
		var endFieldLabel = endTargetObj.fieldLabel;
		var operator = field.compare.operator;
		if (startFieldLabel && startFieldLabel.length != 0) {
			startFiledLabel = '起始时间';
		}
		if (endFieldLabel && endFieldLabel.length != 0) {
			tmpTips = endFieldLabel;
		} else {
			tmpTips = '结束时间 ';
		}
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['multitimecompText'] = tmpTips;
			return false;
		}		
		if(field.compare) {
			if (dtype == 'date') {				
				startTargetVal = startTargetVal.toString();
				endTargetVal = endTargetVal.toString();
				startTimeVal = Ext.data.validations.timeStr2Int(startTimeVal);
				selfVal = Ext.data.validations.timeStr2Int(v);
			} else if (dtype == 'week') {
				startTargetVal = parseInt(startTargetVal, 10);
				endTargetVal = parseInt(endTargetVal, 10);
				startTimeVal = Ext.data.validations.timeStr2Int(startTimeVal);
				selfVal = Ext.data.validations.timeStr2Int(v);				
			}
			
			if (operator == '>=' && (startTargetVal == endTargetVal && startTimeVal > selfVal)) {
				tmpTips += '应该大于或等于' + (startFieldLabel ? startFieldLabel : "起始时间");
				Ext.form.VTypes['multitimecompText'] = tmpTips;
				return false;
			}
		}
		return true;
	},
	'multitimecompText' : '请输入合法值',
	
	//daterange
	'daterange': function(val, field) {
        var date = field.parseDate(val);

        if(!date){
            return;
        }
        if (field.startDateField && (!this.dateRangeMax || (date.getTime() != this.dateRangeMax.getTime()))) {
            var start = Ext.getCmp(field.startDateField);
            start.setMaxValue(date);
            start.validate();
            this.dateRangeMax = date;
        } 
        else if (field.endDateField && (!this.dateRangeMin || (date.getTime() != this.dateRangeMin.getTime()))) {
            var end = Ext.getCmp(field.endDateField);
            end.setMinValue(date);
            end.validate();
            this.dateRangeMin = date;
        }
        
        return true;
    },
	'daterangeText': '请输入合法日期',
	
	/*
	*  check input value type and range
	*  向form添加组件时组件配置validate属性格式如下：
	*  dtype: hex, int...持续扩展中...
	*  min: 自身匹配的最小值
	*  max: 自身匹配的最大值
	*  
		vtype: 'range',
		range: {
			dtype: 'hex',
			min: '0001',
			max: 'FFFFFFFF'
		}
	*  
	* */
	'range' : function (v, field) {
		var tmpTips = '';
		
		if(field.range) {
			var dtype = field.range.dtype;
			var min = field.range.min;
			var max = field.range.max;
			var unsigned = field.range.unsigned || true; // handle case like "+123"
			
			var exception = null;
			if( field.range.exception != undefined ){
				exception = field.range.exception;	
			}
			
			var tmpVal = 0;
			var allowBlank = field.allowBlank;	
			if (!allowBlank && v.length == 0) {
				tmpTips += '不能为空';
				Ext.form.VTypes['rangeText'] = tmpTips;
				return false;
			}
			
			if (dtype == 'int') {
				if (Ext.data.validations.isInt(v) == false || (unsigned && /^\+/.test(v))) {
					tmpTips = '数据格式错误!&nbsp;<br/>数据是十进制整数';
					Ext.form.VTypes['rangeText'] = tmpTips;
					return false;
				}
				tmpVal = parseInt(v, 10);
				
				if(null == exception){
				if (tmpVal > parseInt(max, 10) || tmpVal < parseInt(min, 10)) {
					tmpTips = '输入数据越界!&nbsp;<br/>数据范围:' + min + '~' + max;
					Ext.form.VTypes['rangeText'] = tmpTips;
						return false;
					}					
				}else{
					if (tmpVal != parseInt(exception, 10)){
						if (tmpVal > parseInt(max, 10) || tmpVal < parseInt(min, 10)) {
							tmpTips += '输入数据越界!&nbsp;<br/>数据范围:'+ exception +'或' + min + '~' + max;
							Ext.form.VTypes['rangeText'] = tmpTips;
							return false;
						}
					}	
				}
			} else if (dtype == 'hex') {
				if (!Ext.data.validations.isHex(v)) {
					tmpTips = '数据格式错误!&nbsp;<br/>数据是十六进制';
					Ext.form.VTypes['rangeText'] = tmpTips;
					return false;
				}
				tmpVal = parseInt(v, 16);
				if (tmpVal > parseInt(max, 16) || tmpVal < parseInt(min, 16)) {
					tmpTips = '输入数据越界!&nbsp;<br/>数据范围:' + min + '~' + max;
					Ext.form.VTypes['rangeText'] = tmpTips;
					return false;
				}
			}
		}
		
		return true;
	},
	'rangeText' : '请输入合法值!',
	
	'cellphone' : function (v, field) {
		
		var min = field.minLength;
		var max = field.maxLength;
		if ( v.length == 0 ){
			return true;
		}
		if (v.length < min || v.length > max) {
			return false;
		}
		if (!v.match(Ext.data.validations.numRegex)) {
			return false;
		}
		return true;
	},
	'cellphoneText': '请输入合法的手机号码',
	
	//hexrange
	'hexrange': function (v, field) {
		var tmpTips = '';
		if(field.hexrange) {
			
			var min = field.hexrange.min;
			var max = field.hexrange.max;
			var tmpVal = 0;
			var allowBlank = field.allowBlank;
			
			if (!allowBlank && v.length == 0) {
				tmpTips += '不能为空';
				Ext.form.VTypes['hexrangeText'] = tmpTips;
				return false;
			}

			if (!Ext.data.validations.isHex(v)) {
				tmpTips = '数据格式错误!<br/>数据是十六进制';
				Ext.form.VTypes['hexrangeText'] = tmpTips;
				return false;
			}
			tmpVal = parseInt(v, 16);
			if (tmpVal > parseInt(max, 16) || tmpVal < parseInt(min, 16)) {
				tmpTips = '输入数据越界!';
				Ext.form.VTypes['hexrangeText'] = tmpTips;
				return false;
			}

		}

		return true;
	},
	'hexrangeText' : '请输入合法值!<br/>',
	
	//Url
	'url': function (v, field) {
		return Ext.data.validations.isUrl(v);
	},
	'urlText': '请输入合法的url，格式如：http://www.example.com',
	
	//snmpmask
	'snmpmask': function (v, field) {
		var tmpTips = '';
		var targetIp = Ext.getCmp(field.snmpmask.targetId);
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['snmpmaskText'] = tmpTips;
			return false;
		}

		if (v.length != 0) {
			if (Ext.data.validations.isNumNetmask(v, 'ipv4') == true) {
				if(targetIp.isValid() && targetIp.getValue()){
					if(!Ext.data.validations.checkBrIp(targetIp.getValue(),v)){
							targetIp.markInvalid("ip地址不能为回环、组播、广播和网络地址");
						}else{
							targetIp.clearInvalid();
						}
				}
				return true;
			}
			if (Ext.data.validations.isWildNetmaskV4(v) == true) {
				if(targetIp.isValid()  && targetIp.getValue()){
					if(!Ext.data.validations.checkBrIp(targetIp.getValue(),v)){
							targetIp.markInvalid("ip地址不能为回环、组播、广播和网络地址");
						}else{
							targetIp.clearInvalid();
						}
				}		
				return true;
			}
			return false;
		}
		return true;
	},
	'snmpmaskText': '请输入合法的子网掩码!',
	
	//snmpIp
	'snmpip' : function (v, field) {
		var tmpTips = '';
		var targetMask = Ext.getCmp(field.snmpip.targetId).getValue();
		var isIPV4 = false;	
		this.snmpipText = '请输入合法的IP地址!';
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['ipx0Text'] = tmpTips;
			return false;
		}
		isIPV4 = Ext.data.validations.isIpv4(v, 2);
		if (isIPV4) {
			if(targetMask && !checkBrIp(v,targetMask)){
					this.snmpipText = "ip地址不能为回环、组播、广播和网络地址"
					return false;
			}
			return true;
		}
		return false;
	},
	'snmpipText' : '请输入合法的IP地址',
	
	//ipx3
	'ipx3' : function (v, field) {
		var tmpTips = '';
		var isIPV4 = false;
		this.ipx3Text = '请输入合法的IP地址!';
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['ipx3Text'] = tmpTips;
			return false;
		}
		isIPV4 = Ext.data.validations.isIpv4(v, 3);
		
		if (isIPV4) {			//由于暂不支持IPv6,在条件内去除"|| isIPV6"
			var reg = /\d{1,3}/;
			var firstIp = v.match(reg);
			if(v == "127.0.0.1" || (firstIp >= "224" && firstIp<"240")){
				this.ipx3Text = "ip地址不能为回环和组播地址";
				return false;
			}
			return true;
		}
		return false;
	},
	'ipx3Text': '请输入合法的IP地址',
	
	//domainorip2
	'domainorip2': function (v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['domainText'] = tmpTips;
			return false;
		}
		if (v.length != 0) {
			if (Ext.data.validations.isDomain(v) 
				|| Ext.data.validations.isIpv4OrNetMask(v) 
				|| Ext.data.validations.isIpv6(v)) {
				return true;
			} else {
				return false;
			}
		}
		return true;
	},
	'domainorip2Text': '请输入合法的域名或IP地址/掩码!',
	'wildcardmask': function (v, field) {
		var me = this, tmpTips = '';

		if (!field.allowBlank && v.length == 0) {
			tmpTips += '不能为空';
			Ext.form.VTypes['wildcardmaskText'] = tmpTips;
			return false;
		}
		if (!Ext.data.validations.isIpv4(v)) {
			tmpTips += me['ipv4Text'];
			Ext.form.VTypes['wildcardmaskText'] = tmpTips;
			return false;
		}
		if (32 - hscore.utils.Utils.ipToMaskInt(v) > 8) {
			return false;
		}
		return true;
	},
	'wildcardmaskText' : '通配符掩码不支持此输入(转为2进制后超过8位为0)',
	'pathValidator':function (value){
		if(value == "") return true;
		var result = true;
		
		//匹配www.aa.com,www.bb.com		
		var reg = /^\//; 

		result = reg.test(value);
		return result;
	},
	'pathValidatorText':'请输入合法的路径,格式如：/tmp',
	'cellphone' : function (v, field) {
		
		var min = field.minLength;
		var max = field.maxLength;
		if ( v.length == 0 ){
			return true;
		}
		if (v.length < min || v.length > max) {
			return false;
		}
		if (!/^[0-9]+([0-9]+|\-)*[0-9]+$/.test(v) || /\-{2,}/.test(v)) {
			return false;
		}
		return true;
	},
	'cellphoneText': '请输入合法的手机号码',
	'dstip': function (v, field) {
		var me = this;
			
		if (!me.ip(v, field)) {
			me['dstipText'] = me['ipText'];
			return false;
		}
		
		if (me.ip(v, field) && /127\.0\.0\.1/.test(v)) {
			 me['dstipText'] = '目的IP不能配置本机地址 &nbsp;';
			return false;
		}
		return true;
	},
	'dstipText' : '目的IP不能配置本机地址 &nbsp;',
	
	/************测试工具**************/
	/**
	 * 检查是否为DNS
	 */
	'tldns' : function(value) {
		if (value) {
			var flag1 = !Ext.data.validations.checkDomainName(value);
			var flag2 = !Ext.data.validations.checkIPV4(value, true, true);
			if (flag1 && flag2) {
				return true;
			} else {
				return false;
			}
		}
		return true;
	},
	'tldnsText' : '请输入合法的域名，每个标号不超过63个字符。如：abc.com。', //getLangStr('testtool_rule_1'),
	/**
	 * 检查是否可以进行ping
	 */
	'tlping' : function(value) {
		if (value) {
			var flag = Ext.data.validations.checkIPorDomainName(value, true, false);
			if (flag) {
				return false;
			} else {
				return true;
			}
		}
		return true;
	},
	'tlpingText' : '请输入合法的域名或IP地址！格式如：abc.com或127.0.0.1。', //getLangStr('testtool_rule_2')
	
	'portalfield' : function (val, field) {
		var ml = field.maxLength;
		if (val == null || val == '')
			return false;
		if (val.length > ml)
			return false;
		if (/ /.test(val)) {
			Ext.form.VTypes.portalFieldText = '此字段中的值无效'; 
			return false;
		}
		var portalReg = /^http(s?):\/\//;
		if (!portalReg.test(val.toLowerCase())) {
			Ext.form.VTypes.portalFieldText = '此字段必须以http://或者https://开头';
			return false;
		}
		return true;
	},
	'portalfieldText' : '此字段必须以http://或者https://开头'
})